/*
 * @Author: shiguo
 * @Date: 2022-04-21 14:40:29
 * @LastEditors: shiguo
 * @LastEditTime: 2022-07-08 15:40:21
 * @FilePath: /@aks-dev/easyui/lib/Badge/Badge.tsx
 */
import React from 'react'
import { View, Text, } from 'react-native'
import { px2dp } from '../../screen/px2dp'
import { px2sp } from '../../screen/px2sp'


import type { BadgeProps } from '.'



export const Badge: React.FC<BadgeProps>
    = (props) => {
        if (isNaN(+props.count) || Number(props.count) == 0) return <View />
        return (

            <View style={
                [
                    {
                        flexGrow: 0, flexShrink: 1, zIndex: 1,
                        // paddingHorizontal: px2dp(0),
                        height: px2dp(16), minWidth: px2dp(16), borderRadius: px2dp(8),
                        justifyContent: 'center', alignItems: 'center',
                        backgroundColor: 'red'
                    },
                    props.style
                ]
            } >
                <Text style={{ fontSize: px2sp(12), color: 'white', textAlign: 'center' }}> {props.count > 99 ? '+99' : props.count} </Text>

            </View>
        )
    }

